package puzzle;

public class PuzzleBoardPossition {

	private int x;
	private int y;
	
	public PuzzleBoardPossition(int pos) {
		
        switch (pos)
        {
            case 0:
                x = 0;
                y = 1;
                break;
            case 1:
            	x = 0;
                y = 2;
                break;
            case 2:
            	x = 1;
                y = 0;
                break;
            case 3:
            	x = 1;
                y = 1;
                break;
            case 4:
            	x = 1;
                y = 2;
                break;
            case 5:
            	x = 1;
                y = 3;
                break;
            case 6:
            	x = 2;
                y = 0;
                break;
            case 7:
            	x = 2;
                y = 1;
                break;
            case 8:
            	x = 2;
                y = 2;
                break;
            case 9:
            	x = 2;
                y = 3;
                break;
            case 10:
            	x = 3;
                y = 1;
                break;
            case 11:
            	x = 3;
                y = 2;
                break;
        }
	}
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	public int getDistance(PuzzleBoardPossition otherPos) {
		int distance = 0;
		distance += Math.abs(getX() - otherPos.getX());
        distance += Math.abs(getY() - otherPos.getY());
        return distance;
	}
}
